products = [["iphone",6888],["MacPro",14800],["小米6",2499],["Coffee",31],["Book",60],["Nike",699]]

shop_car = []
shop_cost = []
flag = True

for i in products:
    shop_cost.append(i[0])

#print(shop_car)

while flag :
    
    a = input("请输入您想购买的商品名称；输入q，退出")

    if a == 'q':
        flag = False
        print("您订购的商品:",shop_car)
    elif a in shop_cost :
        if a in shop_car:
            print("您已添加购物车，请勿重复添加")
        else:
            shop_car.append(a)
            print(a,"已加入购物车")
    else:
        print("您输入的商品不存在，请输入商品名称")

# 商品没有展示出来，没有办法购买